package br.com.fatecpg.fatecMobile;

import android.os.Bundle;
import android.app.TabActivity;
import android.content.Intent;
import android.view.Menu;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class ApplicationActivity extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_application);
        TabHost tabHost = getTabHost();
        
        TabSpec avaliationSpec = tabHost.newTabSpec("Notas/Faltas");
        avaliationSpec.setIndicator("Notas/Faltas", getResources().getDrawable(R.drawable.notes_icon));
        Intent avaliationIntent = new Intent(ApplicationActivity.this, AvaliationActivity.class);
        avaliationSpec.setContent(avaliationIntent);
         
        TabSpec faultsSpec = tabHost.newTabSpec("Faltas");  
        faultsSpec.setIndicator("Faltas de Professores", getResources().getDrawable(R.drawable.faults_icon));
        Intent faultsIntent = new Intent(ApplicationActivity.this, FaultsActivity.class);
        faultsSpec.setContent(faultsIntent);
        
        TabSpec eventsSpec = tabHost.newTabSpec("Eventos");  
        eventsSpec.setIndicator("Eventos", getResources().getDrawable(R.drawable.events_icon));
        Intent eventsIntent = new Intent(ApplicationActivity.this, EventsActivity.class);
        eventsSpec.setContent(eventsIntent);
        
        TabSpec disciplinesSpec = tabHost.newTabSpec("Disciplinas");  
        disciplinesSpec.setIndicator("Disciplinas", getResources().getDrawable(R.drawable.disciplines_icon));
        Intent disciplinesIntent = new Intent(ApplicationActivity.this, DisciplinesActivity.class);
        disciplinesSpec.setContent(disciplinesIntent);
        
        TabSpec warningsSpec = tabHost.newTabSpec("Avisos");  
        warningsSpec.setIndicator("Avisos", getResources().getDrawable(R.drawable.warning_icon));
        Intent warningsIntent = new Intent(ApplicationActivity.this, WarningsActivity.class);
        warningsSpec.setContent(warningsIntent);
        
        tabHost.addTab(avaliationSpec);
        tabHost.addTab(faultsSpec);
        tabHost.addTab(eventsSpec);
        tabHost.addTab(disciplinesSpec);
        tabHost.addTab(warningsSpec);
        
        Intent i = getIntent();
        Bundle params = i.getExtras();
        
        if(params != null){
        	tabHost.setCurrentTab(params.getInt("currentTab"));
        }
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.application, menu);
		return true;
	}

}
